#include "websockettest.h"

WebSocketTest::WebSocketTest(QObject *parent) : QObject(parent)
{

}

void WebSocketTest::test(){
    QWebSocket* m_pWebSocket = new QWebSocket();
    // 连接信号与槽
    connect(m_pWebSocket, &QWebSocket::textMessageReceived, this, &WebSocketTest::onTextMessageReceived);
    m_pWebSocket->open(QUrl("ws://127.0.0.1:8080/ws"));
}


void WebSocketTest::onTextMessageReceived(QString message)
{
    qDebug() << "Text Message received:" << message;
}
